﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp11
{
    class Father
    {
        int sum = 0;
        int shengli = 0;
        int shu = 0;
        int he = 0;

        private string shitou;
        private string jiandao;
        private string bu;
        private string name;


        public string Shitou { get => shitou; set => shitou = value; }
        public string Jiandao { get => jiandao; set => jiandao = value; }
        public string Bu { get => bu; set => bu = value; }
        public string Name { get => name; set => name = value; }

        public Father() { }

        public Father(string shitou, string jiandao, string bu)
        {
            this.Shitou = shitou;
            this.Jiandao = jiandao;
            this.Bu = bu;
        }
        public void Name1()
        {
            Console.WriteLine("请输入你的姓名：");
            this.Name = Console.ReadLine();
            Console.WriteLine();
        }
        public void chuquan()
        {
            Console.WriteLine("请出拳：1.{0} 2.{1} 3.{2}  （请输入相应数字：）", this.Shitou, this.Jiandao, this.Bu);
        }

        public void lun1()
        {
            Console.WriteLine("是否开启下一轮？<y/n>");
            sum++;
            string lun = Console.ReadLine();
            if (lun == "y")
            {
                Father quan = new Father("石头", "剪刀", "布");
                quan.chuquan();
                quan.change1();
            }
            else if (lun == "n")
            {
                Console.WriteLine();
                Console.WriteLine("你取消了下一轮！");
                Console.WriteLine("===============================");
                jishu();
            }
        }

        public void change1()
        {
            int quan2 = int.Parse(Console.ReadLine());
            Random ran = new Random();
            int suiji = ran.Next(1, 4);

            if (quan2 == 1 & suiji == 2)
            {
                Father father = new Father();
                Console.WriteLine("你,出拳：石头");
                Console.WriteLine("刘备,出拳：剪刀");
                Console.WriteLine("恭喜，你赢了！");
                lun1();
                shengli++;
            }
            else if (quan2 == 1 & suiji == 3)
            {
                Father father = new Father();
                Console.WriteLine("你,出拳：石头");
                Console.WriteLine("刘备,出拳：布");
                Console.WriteLine("笨蛋，你输了！");
                lun1();
                shu++;
            }
            else if (quan2 == 2 & suiji == 1)
            {
                Father father = new Father();
                Console.WriteLine("你,出拳：剪刀");
                Console.WriteLine("刘备,出拳：石头");
                Console.WriteLine("笨蛋，你输了！");
                lun1();
                shu++;
            }
            else if (quan2 == 2 & suiji == 3)
            {
                Father father = new Father();
                Console.WriteLine("你,出拳：剪刀");
                Console.WriteLine("刘备,出拳：布");
                Console.WriteLine("恭喜，你赢了！");
                lun1();
                shengli++;
            }
            else if (quan2 == 3 & suiji == 1)
            {
                Father father = new Father();
                Console.WriteLine("你,出拳：布");
                Console.WriteLine("刘备,出拳：石头");
                Console.WriteLine("恭喜，你赢了！");
                lun1();
                shengli++;
            }
            else if (quan2 == 3 & suiji == 2)
            {
                Father father = new Father();
                Console.WriteLine("你,出拳：布");
                Console.WriteLine("刘备,出拳：剪刀");
                Console.WriteLine("笨蛋，你输了！");
                lun1();
                shu++;
            }
            else if (quan2 == 1 & suiji == 1)
            {
                Console.WriteLine("你,出拳：石头");
                Console.WriteLine("刘备,出拳：石头");
                Console.WriteLine("和局，真衰！嘿嘿，等着瞧吧！");
                lun1();
                he++;
            }
            else if (quan2 == 2 & suiji == 2)
            {
                Console.WriteLine("你,出拳：剪刀");
                Console.WriteLine("刘备,出拳：剪刀");
                Console.WriteLine("和局，真衰！嘿嘿，等着瞧吧！");
                lun1();
                he++;
            }
            else if (quan2 == 3 & suiji == 3)
            {
                Console.WriteLine("你,出拳：布");
                Console.WriteLine("刘备,出拳：布");
                Console.WriteLine("和局，真衰！嘿嘿，等着瞧吧！");
                lun1();
                he++;
            }
        }

        public void change2()
        {
            int quan2 = int.Parse(Console.ReadLine());
            Random ran = new Random();
            int suiji = ran.Next(1, 4);

            if (quan2 == 1 & suiji == 2)
            {
                Father father = new Father();
                Console.WriteLine("你,出拳：石头");
                Console.WriteLine("孙权,出拳：剪刀");
                Console.WriteLine("恭喜，你赢了！");
                lun1();
                shengli++;
            }
            else if (quan2 == 1 & suiji == 3)
            {
                Father father = new Father();
                Console.WriteLine("你,出拳：石头");
                Console.WriteLine("孙权,出拳：布");
                Console.WriteLine("笨蛋，你输了！");
                lun1();
                shu++;
            }
            else if (quan2 == 2 & suiji == 1)
            {
                Father father = new Father();
                Console.WriteLine("你,出拳：剪刀");
                Console.WriteLine("孙权,出拳：石头");
                Console.WriteLine("笨蛋，你输了！");
                lun1();
                shu++;
            }
            else if (quan2 == 2 & suiji == 3)
            {
                Father father = new Father();
                Console.WriteLine("你,出拳：剪刀");
                Console.WriteLine("孙权,出拳：布");
                Console.WriteLine("恭喜，你赢了！");
                lun1();
                shengli++;
            }
            else if (quan2 == 3 & suiji == 1)
            {
                Father father = new Father();
                Console.WriteLine("你,出拳：布");
                Console.WriteLine("孙权,出拳：石头");
                Console.WriteLine("恭喜，你赢了！");
                lun1();
                shengli++;
            }
            else if (quan2 == 3 & suiji == 2)
            {
                Father father = new Father();
                Console.WriteLine("你,出拳：布");
                Console.WriteLine("孙权,出拳：剪刀");
                Console.WriteLine("笨蛋，你输了！");
                lun1();
                shu++;
            }
            else if (quan2 == 1 & suiji == 1)
            {
                Console.WriteLine("你,出拳：石头");
                Console.WriteLine("孙权,出拳：石头");
                Console.WriteLine("和局，真衰！嘿嘿，等着瞧吧！");
                lun1();
                he++;
            }
            else if (quan2 == 2 & suiji == 2)
            {
                Console.WriteLine("你,出拳：剪刀");
                Console.WriteLine("孙权,出拳：剪刀");
                Console.WriteLine("和局，真衰！嘿嘿，等着瞧吧！");
                lun1();
                he++;
            }
            else if (quan2 == 3 & suiji == 3)
            {
                Console.WriteLine("你,出拳：布");
                Console.WriteLine("孙权,出拳：布");
                Console.WriteLine("和局，真衰！嘿嘿，等着瞧吧！");
                lun1();
                he++;
            }
        }

        public void change3()
        {
            int quan2 = int.Parse(Console.ReadLine());
            Random ran = new Random();
            int suiji = ran.Next(1, 4);

            if (quan2 == 1 & suiji == 2)
            {
                Father father = new Father();
                Console.WriteLine("你,出拳：石头");
                Console.WriteLine("曹操,出拳：剪刀");
                Console.WriteLine("恭喜，你赢了！");
                lun1();
                shengli++;
            }
            else if (quan2 == 1 & suiji == 3)
            {
                Father father = new Father();
                Console.WriteLine("你,出拳：石头");
                Console.WriteLine("曹操,出拳：布");
                Console.WriteLine("笨蛋，你输了！");
                lun1();
                shu++;
            }
            else if (quan2 == 2 & suiji == 1)
            {
                Father father = new Father();
                Console.WriteLine("你,出拳：剪刀");
                Console.WriteLine("曹操,出拳：石头");
                Console.WriteLine("笨蛋，你输了！");
                lun1();
                shu++;
            }
            else if (quan2 == 2 & suiji == 3)
            {
                Father father = new Father();
                Console.WriteLine("你,出拳：剪刀");
                Console.WriteLine("曹操,出拳：布");
                Console.WriteLine("恭喜，你赢了！");
                lun1();
                shengli++;
            }
            else if (quan2 == 3 & suiji == 1)
            {
                Father father = new Father();
                Console.WriteLine("你,出拳：布");
                Console.WriteLine("曹操,出拳：石头");
                Console.WriteLine("恭喜，你赢了！");
                lun1();
                shengli++;
            }
            else if (quan2 == 3 & suiji == 2)
            {
                Father father = new Father();
                Console.WriteLine("你,出拳：布");
                Console.WriteLine("曹操,出拳：剪刀");
                Console.WriteLine("笨蛋，你输了！");
                lun1();
                shu++;
            }
            else if (quan2 == 1 & suiji == 1)
            {
                Console.WriteLine("你,出拳：石头");
                Console.WriteLine("曹操,出拳：石头");
                Console.WriteLine("和局，真衰！嘿嘿，等着瞧吧！");
                lun1();
                he++;
            }
            else if (quan2 == 2 & suiji == 2)
            {
                Console.WriteLine("你,出拳：剪刀");
                Console.WriteLine("曹操,出拳：剪刀");
                Console.WriteLine("和局，真衰！嘿嘿，等着瞧吧！");
                lun1();
                he++;
            }
            else if (quan2 == 3 & suiji == 3)
            {
                Console.WriteLine("你,出拳：布");
                Console.WriteLine("曹操,出拳：布");
                Console.WriteLine("和局，真衰！嘿嘿，等着瞧吧！");
                lun1();
                he++;
            }
        }

        public void jishu()
        {
            Console.WriteLine("");
            Console.WriteLine("对战次数{0}", sum);
            Console.WriteLine("胜利次数{0}", shengli);
            Console.WriteLine("失败次数{0}", shu);
            Console.WriteLine("平局次数{0}", he);
            Console.WriteLine();
            Console.WriteLine("要开始下一局吗？(y/n)");
            string ju = Console.ReadLine();
            if (ju == "y")
            {
                Program program = new Program();
                program.main2();
            }
            else if (ju == "n")
            {
                Console.WriteLine("系统退出！");
                Environment.Exit(0);
            }
        }
    }
}


